home *** CD-ROM | disk | FTP | other *** search
- Path: news.infi.net!usenet
- From: nngis@norfolk.infi.net (Greg DiGiorgio)
- Newsgroups: comp.lang.c
- Subject: Re: HELP NEEDED: Passing input to an already running program.
- Date: 13 Jan 1996 14:55:44 GMT
- Organization: Customer of InfiNet
- Message-ID: <4d8h5g$jrv@news.infi.net>
- References: <30F5BFB6.75CF@cnsunix.albany.edu>
- NNTP-Posting-Host: h-dclaiborne.norfolk.infi.net
- Mime-Version: 1.0
- X-Newsreader: WinVN 0.99.3
-
- In article <30F5BFB6.75CF@cnsunix.albany.edu>, np1010@cnsunix.albany.edu
- says...
- >
- >I posted this about a day ago with no response. I am a little anxious
- to
- >get this problem solved.
- >
- >I am writing an application that will "launch" another program called
- >irc. The problem is I need to pass input to irc once I invoke it from
- >the original program. IRC will be invoked using the funtion system().
- >Once irc is called it takes input from the keyboard. This is what I
- have
- >tried so far:
-
- As another wrote, I don't know which OS you are talking about, but let's
- assume several. Additionally, I'll also assume that IRC is not your
- program
- so you can't recode it to look for a disk file, for example.
-
- First, MS-DOS:
- There is no inherent support for interprogram communication in MS-DOS.
- What
- you can do is use a DOS-only function to fill the keyboard. There is a
- propietary function in Turbo/Borland-C/C++ to do this. The problem is
- that
- MS-DOS is not a multi-tasking OS, so once IRC starts running, your
- program
- suspends. So, there is no way you can control IRC remotely unless you add
- multi-tasking to your program (which you can sort of do by hooking into
- the
- timer interrupt - good luck on that one, you'll have to write a TSR).
-
- Second, Windows:
- There are several mechanisms you can use to remotely control an
- application
- in Windows.Since Windows does multi-task, your program will continue to
- run
- along with the other. If IRC supports DDE then you can use DDE to control
- IRC. DDE is an interface for interprogram communication. If IRC does not
- support DDE, then you can send keystrokes directly to an application from
- a
- background application. This function is very easy using Visual BASIC and
- its SENDKEY procedure. Under C/C++, it is more work.
-
- Third, UNIX - look at the previous poster's comments.
-
- >
- >-> Using fprintf(stdin, ".....");
- >I thought that if I wrote to the stdin file, it would be passed to IRC
- as
- >input from the keyboard. This didn't work.
- >
- >-> Using system("...");
- >This didn't work either. it just passed commands to the shell that IRC
- >was running from.
- >
- >-> Redirecting input using the system("irc < input.file")
- >This worked and inputted the commands that were contained in input.file
- >but afterwards the IRC program frose on me and would not accept input
- >anymore.
- >
- >Can anyone help me here? I would apprecate any help that can be
- offered.
- >
- > - Nicholas Paldino
- > - np1010@cnsunix.albany.edu
-
-